package com.shfl.servermanage.logic.constants;

public class CommonConstants {

    // 文件存放地址 可以存在数据库 方便迁移
    public static final String FILE_ADDRESS = "D:\\test";

    // 文件阅读地址
    public static final String FILE_ADDRESS_READ = "/file";

    public static final String BT_ROOT_DIRECTORY = "/www/wwwroot";


    public enum DeleteFlg {
        NOT_DELETE(1, "未删除"),
        DELETE(0, "已删除"),
        ;
        Integer code;
        String value;

        DeleteFlg(Integer code, String value) {
            this.code = code;
            this.value = value;
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }

    public enum AttachType {
        EXECUTABLE_FILES(1, "executable_file", "executableFile", "执行文件"),
        SHELL_LOG(2, "shell_log", "shellLog", "shell脚本文件"),
        SITE_CONFIG(3, "site_config", "siteConfig", "站点配置文件"),
        ;
        Integer code;
        String value;
        String docs;
        String folder;

        AttachType(Integer code, String value, String folder, String docs) {
            this.folder = folder;
            this.code = code;
            this.docs = docs;
            this.value = value;
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getDocs() {
            return docs;
        }

        public void setDocs(String docs) {
            this.docs = docs;
        }

        public String getFolder() {
            return folder;
        }

        public void setFolder(String folder) {
            this.folder = folder;
        }
    }

    public enum ExecutableType {
        TYPE_00(0, "静态文件"),
        TYPE_01(1, "JAR文件"),
        ;
        Integer code;
        String value;

        ExecutableType(Integer code, String value) {
            this.code = code;
            this.value = value;
        }

        public static String getValue(Integer code) {
            for (ExecutableType executableType : ExecutableType.values()) {
                if (executableType.getCode().equals(code)) {
                    return executableType.getValue();
                }
            }

            return "";
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }
}
